package models

import (
	"github.com/astaxie/beego"
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
)

var DB *gorm.DB
var err error

func init() {
	dsn := "root:root@tcp(39.100.195.180:3306)/beego?charset=utf8"
	dbType := "mysql"
	DB, err = gorm.Open(dbType, dsn)
	if err != nil {
		beego.Info("数据库链接失败")
		return
	}
	DB.LogMode(true)
}
